using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using TMPro;

public class SelectableItem : MonoBehaviour, IPointerClickHandler
{
    public Image background;
    public TMP_Text label;
    public Color color;

    public int Index { get; set; }
    public ScrollViewController Controller { get; set; } 

    public void SetText(string text)
    {
        label.text = text;
    }

    public void SetHighlighted(bool isHighlighted)
    {
        background.color = isHighlighted ? color : Color.gray;
    }

    public void OnPointerClick(PointerEventData eventData)
    {
        if (Controller != null)
        {
            Controller.OnItemClickedByMusicIndex(Index);
        }
    }
}
